/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MenuAdmin.java
 *
 * Created on Jul 8, 2011, 3:15:18 AM
 */

package janelas;

import java.util.ResourceBundle;
import javax.swing.JOptionPane;

/**
 * 
 * @author Wagner
 */

public class MenuAdmin extends javax.swing.JInternalFrame {

    SalasDisponiveis salas;
    GerenciarSalas salasG;
    GerenciarLabs labsG;
    InserirAdmin adminI;
    GerenciarEquipamento gerenciarEquip;
    GerenciarReservas gerenciarSala;

    String idioma;
    String usuario;
    /** Creates new form MenuAdmin */
    public MenuAdmin(String idioma, String usuario) {
        initComponents();

        this.salas  = new SalasDisponiveis(idioma,usuario);
        this.salasG = new GerenciarSalas(idioma,usuario);
        this.adminI = new InserirAdmin(idioma,usuario);
        this.gerenciarEquip = new GerenciarEquipamento(idioma,usuario);
        this.labsG = new GerenciarLabs(idioma,usuario);
        this.gerenciarSala = new GerenciarReservas(idioma, usuario);
        
        alterarIdioma(idioma);

        this.idioma = idioma;
        this.usuario = usuario;

        jiduser.setText(usuario);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktop = new javax.swing.JDesktopPane();
        titulo = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        juser = new javax.swing.JLabel();
        jiduser = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenuAdmin = new javax.swing.JMenu();
        jMenuSolicitacao = new javax.swing.JMenu();
        jMenuGerenciarSolicitacao = new javax.swing.JMenu();
        menuSala = new javax.swing.JMenuItem();
        menuLab = new javax.swing.JMenuItem();
        jMenuRegistros = new javax.swing.JMenu();
        jMenuSala = new javax.swing.JMenuItem();
        jMenuLab = new javax.swing.JMenuItem();
        jMenuEquipamento = new javax.swing.JMenuItem();
        jMenuRegistroAdmin = new javax.swing.JMenuItem();
        jMenuOpcao = new javax.swing.JMenu();
        jMenuDisponibilidade = new javax.swing.JMenu();
        jMenuDispoSala = new javax.swing.JMenuItem();
        jMenuDispoLab = new javax.swing.JMenuItem();

        setPreferredSize(new java.awt.Dimension(800, 620));

        desktop.setBackground(new java.awt.Color(238, 238, 238));

        titulo.setFont(new java.awt.Font("Lucida Grande", 1, 13));
        titulo.setText("Menu Usuario");
        titulo.setBounds(30, 30, 170, 16);
        desktop.add(titulo, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jSeparator2.setBounds(20, 50, 730, 20);
        desktop.add(jSeparator2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        juser.setFont(new java.awt.Font("Lucida Grande", 1, 13));
        juser.setText("Usuário");
        juser.setBounds(432, 30, 70, 16);
        desktop.add(juser, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jiduser.setText("ID User");
        jiduser.setBounds(510, 30, 160, 16);
        desktop.add(jiduser, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jMenuAdmin.setText("Menu Administrador");

        jMenuSolicitacao.setText("Menu Solicitacao");

        jMenuGerenciarSolicitacao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/book_open.png"))); // NOI18N
        jMenuGerenciarSolicitacao.setText("Menu Gerenciar");

        menuSala.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/book.png"))); // NOI18N
        menuSala.setText("Sala");
        menuSala.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSalaActionPerformed(evt);
            }
        });
        jMenuGerenciarSolicitacao.add(menuSala);

        menuLab.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/server.png"))); // NOI18N
        menuLab.setText("Laboratorio");
        menuLab.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuLabActionPerformed(evt);
            }
        });
        jMenuGerenciarSolicitacao.add(menuLab);

        jMenuSolicitacao.add(jMenuGerenciarSolicitacao);

        jMenuAdmin.add(jMenuSolicitacao);

        jMenuRegistros.setText("Menu Registros");

        jMenuSala.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/book.png"))); // NOI18N
        jMenuSala.setText("jMenu Sala");
        jMenuSala.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuSalaActionPerformed(evt);
            }
        });
        jMenuRegistros.add(jMenuSala);

        jMenuLab.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/server.png"))); // NOI18N
        jMenuLab.setText("Menu Laboratorio");
        jMenuLab.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuLabActionPerformed(evt);
            }
        });
        jMenuRegistros.add(jMenuLab);

        jMenuEquipamento.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/monitor.png"))); // NOI18N
        jMenuEquipamento.setText("Menu Equipamento");
        jMenuEquipamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuEquipamentoActionPerformed(evt);
            }
        });
        jMenuRegistros.add(jMenuEquipamento);

        jMenuRegistroAdmin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/user_add.png"))); // NOI18N
        jMenuRegistroAdmin.setText("Menu Registro Admin");
        jMenuRegistroAdmin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuRegistroAdminActionPerformed(evt);
            }
        });
        jMenuRegistros.add(jMenuRegistroAdmin);

        jMenuAdmin.add(jMenuRegistros);

        jMenuBar1.add(jMenuAdmin);

        jMenuOpcao.setText("Menu Opcao");

        jMenuDispoSala.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/book.png"))); // NOI18N
        jMenuDispoSala.setText("Menu Disponibilidade Sala");
        jMenuDispoSala.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuDispoSalaActionPerformed(evt);
            }
        });
        jMenuDisponibilidade.add(jMenuDispoSala);

        jMenuDispoLab.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/server.png"))); // NOI18N
        jMenuDispoLab.setText("Menu Disponibilidade Laboratorio");
        jMenuDispoLab.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuDispoLabActionPerformed(evt);
            }
        });
        jMenuDisponibilidade.add(jMenuDispoLab);

        jMenuOpcao.add(jMenuDisponibilidade);

        jMenuBar1.add(jMenuOpcao);

        setJMenuBar(jMenuBar1);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(desktop, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 776, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, desktop, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 552, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuDispoSalaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuDispoSalaActionPerformed
        // TODO add your handling code here:
        desktop.removeAll();

        novaSala();

        desktop.add(salas);
    }//GEN-LAST:event_jMenuDispoSalaActionPerformed

    private void jMenuDispoLabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuDispoLabActionPerformed
        // TODO add your handling code here:

        if(idioma.equals("en_US")){
            JOptionPane.showMessageDialog(null, "Sorry, but this functionality isn't working!", "Sorry!", JOptionPane.ERROR_MESSAGE);
        }else{
            JOptionPane.showMessageDialog(null, "Desculpe, mas essa funcionalidade não está funcionando!", "Desculpa!", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_jMenuDispoLabActionPerformed

    private void jMenuRegistroAdminActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuRegistroAdminActionPerformed
        // TODO add your handling code here:
        //inserir admin
        desktop.removeAll();

        novaAdminI();

        desktop.add(adminI);
    }//GEN-LAST:event_jMenuRegistroAdminActionPerformed

    private void jMenuEquipamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuEquipamentoActionPerformed
        // TODO add your handling code here:
        desktop.removeAll();

        novaEquipsG();

        desktop.add(gerenciarEquip);
    }//GEN-LAST:event_jMenuEquipamentoActionPerformed

    private void jMenuSalaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuSalaActionPerformed
        // TODO add your handling code here:
        desktop.removeAll();

        novaSalasG();

        desktop.add(salasG);
    }//GEN-LAST:event_jMenuSalaActionPerformed

    private void jMenuLabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuLabActionPerformed
        // TODO add your handling code here:
        desktop.removeAll();

        novaLabsG();

        desktop.add(labsG);
    }//GEN-LAST:event_jMenuLabActionPerformed

    private void menuSalaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSalaActionPerformed
        // TODO add your handling code here:
        desktop.removeAll();

        novaGerenciarSala();

        desktop.add(gerenciarSala);
    }//GEN-LAST:event_menuSalaActionPerformed

    private void menuLabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuLabActionPerformed
        // TODO add your handling code here:

        if(idioma.equals("en_US")){
            JOptionPane.showMessageDialog(null, "Sorry, but this functionality isn't working!", "Sorry!", JOptionPane.ERROR_MESSAGE);
        }else{
            JOptionPane.showMessageDialog(null, "Desculpe, mas essa funcionalidade não está funcionando!", "Desculpa!", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_menuLabActionPerformed

    public void novaAdminI(){
        adminI = new InserirAdmin(idioma,usuario);
    }

    public void novaSala(){
        salas = new SalasDisponiveis(idioma,usuario);
    }

    public void novaSalasG(){
        salasG = new GerenciarSalas(idioma,usuario);
    }

    public void novaLabsG(){
        labsG = new GerenciarLabs(idioma,usuario);
    }

    public void novaEquipsG(){
        gerenciarEquip = new GerenciarEquipamento(idioma,usuario);
    }

    public void novaGerenciarSala(){
        gerenciarSala = new GerenciarReservas(idioma, usuario);
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane desktop;
    private javax.swing.JMenu jMenuAdmin;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuDispoLab;
    private javax.swing.JMenuItem jMenuDispoSala;
    private javax.swing.JMenu jMenuDisponibilidade;
    private javax.swing.JMenuItem jMenuEquipamento;
    private javax.swing.JMenu jMenuGerenciarSolicitacao;
    private javax.swing.JMenuItem jMenuLab;
    private javax.swing.JMenu jMenuOpcao;
    private javax.swing.JMenuItem jMenuRegistroAdmin;
    private javax.swing.JMenu jMenuRegistros;
    private javax.swing.JMenuItem jMenuSala;
    private javax.swing.JMenu jMenuSolicitacao;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JLabel jiduser;
    private javax.swing.JLabel juser;
    private javax.swing.JMenuItem menuLab;
    private javax.swing.JMenuItem menuSala;
    private javax.swing.JLabel titulo;
    // End of variables declaration//GEN-END:variables
    public void alterarIdioma(String idioma){
        ResourceBundle palavras = ResourceBundle.getBundle("idiomas.Lingua_"+idioma);

        this.setTitle(palavras.getString("MenuAdmin.titulo"));

        titulo.setText(palavras.getString("MenuAdmin.titulo"));
        juser.setText(palavras.getString("verificar.user"));

        menuSala.setText(palavras.getString("MenuAdmin.sala"));
        menuLab.setText(palavras.getString("MenuAdmin.lab"));
        jMenuAdmin.setText(palavras.getString("MenuPrincipal.jMenuAdmin"));
        jMenuSolicitacao.setText(palavras.getString("MenuPrincipal.jMenuSolicitacao"));
        jMenuGerenciarSolicitacao.setText(palavras.getString("MenuPrincipal.jMenuGerenciarSolicitacao"));
        jMenuRegistros.setText(palavras.getString("MenuPrincipal.jMenuRegistros"));
        jMenuSala.setText(palavras.getString("MenuPrincipal.jMenuSala"));
        jMenuLab.setText(palavras.getString("MenuPrincipal.jMenuLab"));
        jMenuEquipamento.setText(palavras.getString("MenuPrincipal.jMenuEquipamento"));
        jMenuRegistroAdmin.setText(palavras.getString("MenuPrincipal.jMenuRegistroAdmin"));

        jMenuOpcao.setText(palavras.getString("MenuPrincipal.jMenuOpcao"));
        jMenuDisponibilidade.setText(palavras.getString("MenuPrincipal.jMenuDisponibilidade"));
        jMenuDispoSala.setText(palavras.getString("MenuPrincipal.jMenuDispoSala"));
        jMenuDispoLab.setText(palavras.getString("MenuPrincipal.jMenuDispoLab"));


    }

}
